import axios from '../../plugins/axios.js'

const state = {
	follow:[]   ,//相当于data:[]
	list:[]
}

const actions = {

	follow({state,commit},{_limit,_page}={}) {
					
		axios.get(`/news/follow`, {params: {_limit:_limit||40,_page:_page||1}
					}).then(
						res => {
							// console.log(res)
							commit('follow',res.data)
						}
					)
					
					// setTimeout(() => {
					//   if (refreshing) {
					//     list = [];
					//     refreshing = false;
					//   }
								 
					//   for (let i = 0; i < 10; i++) {
					//     list.push(this.list.length + 1);
					//   }
					//   loading = false;
								 
					//   if (list.length >= 10) {
					//     finished = true;
					//   }
					// }, 1000);
				},
}

const mutations = {
	follow:(state,payload)=>state.follow=payload,
}

export default {
	namespaced:true,
	state,actions,mutations
}